#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    timer=new QTimer(this);
    thread=new thread_one(this);


    connect(ui->pushButton,&QPushButton::clicked,this,&MainWindow::dealclicked);

    connect(timer,&QTimer::timeout,this,&MainWindow::dealtimeout);
    connect(thread,&thread_one::over,this,&MainWindow::dealover);

}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::dealclicked()
{
    timer->start(100);
    thread->start();
}

void MainWindow::dealtimeout()
{
    static int time=0;
    ui->lcdNumber->display(time);
    time++;

}

void MainWindow::dealover()
{
    timer->stop();
}
